import { useHasura } from "@sker/core"
import { useReqBody } from "@sker/runtime"
import { z } from "zod"

const schema = z.object({
    query: z.string(),
    variables: z.optional(z.any()),
})
export default async ()=>{
    const body = schema.parse(useReqBody())
    const res = await useHasura({
        query: body.query,
        variables: body.variables
    })
    return res
}